<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>minOfArr</title>
  <script>
function minOfArr(arr){
   var max = Math.max.apply(null, arr);
   var min = Math.min.apply(null, arr);
   var indexMax = arr.indexOf(max);
   var indexMin = arr.indexOf(min);
   console.log("max: "+ max + " " + "min: " + min + " " + "max index: "+ indexMax + " " + "min index: " + indexMin); 
}
var arr = [1,4,3,-6,8,7,6];
minOfArr(arr);
  </script>
</head>
<body>
  
</body>
</html>